*** REPLICATION TOOLKIT ***

* AUTHORS: CIMINELLI DUVAL FURCERI 

* ARTICLE: EMPLOYMENT PROTECTION DEREGULATION AND LABOR SHARES IN ADVANCED ECONOMIES 

* JOURNAL: REVIEW OF ECONOMICS AND STATISTICS

* OUTPUT: TABLE 1

***************************

cd ""

use "DTA files/Dataset country", clear

putexcel set "Tables/1", modify 

global horizon 6 

************ PREPARE DATASET **********

***labor shares**
gen f1l=100*(ls_agg-l.ls_agg)
gen f2l=100*(f.ls_agg-l.ls_agg)
gen f3l=100*(f2.ls_agg-l.ls_agg)
gen f4l=100*(f3.ls_agg-l.ls_agg)
gen f5l=100*(f4.ls_agg-l.ls_agg)
gen f6l=100*(f5.ls_agg-l.ls_agg)

* Controlling for self-employment
gen ratio=employment/(employment+self_employment)
gen ratio2 = ratio
forvalues i = 1 / 60 {
replace ratio2=f`i'.ratio if ratio2 == .  /*( to fill missing assuming tha the share is equal to its closest value when not available) */
}
gen ls_agg2=ls_agg/ratio2

gen f1l2=100*(ls_agg2-l.ls_agg2)
gen f2l2=100*(f.ls_agg2-l.ls_agg2)
gen f3l2=100*(f2.ls_agg2-l.ls_agg2)
gen f4l2=100*(f3.ls_agg2-l.ls_agg2)
gen f5l2=100*(f4.ls_agg2-l.ls_agg2)
gen f6l2=100*(f5.ls_agg2-l.ls_agg2)

** Controls
* Relative investment price (ratio of investment to capital price level)
gen c1 = pl_i/pl_c
* Trade opennes (share of import plus share of export)
gen c2 = csh_x-csh_m
* Union Density changes
gen c3 = (oecd_UD-l.oecd_UD)

* Crisis dummy
gen lny=ln(gdpv)
gen f1=lny-l.lny
gen gcrisis=0
replace gcrisis=1 if f1<-0.03

************ ANALYSIS **********

mat mat = J(21,$horizon,.)

* Full sample
forvalues i= 1/$horizon {
xtscc  f`i'l EPLregularworkers i.year l(0/4)gcrisis l(1/4)EPLregularworkers l(1/4)EPLtemp l(1/4).f1l ${f`i'}, fe lag(2)
matrix results = r(table)
mat mat[1,`i'] = results[1,1]
mat mat[2,`i'] = results[2,1]
mat mat[3,`i'] = results[4,1]
* Controlling for other labor share drivers
xtscc  f`i'l EPLregularworkers i.year l(0/4)gcrisis l(1/4)EPLregularworkers l(1/4)EPLtemp l(1/4).f1l ${f`i'} c1 c2 c3, fe lag(2)
matrix results = r(table)
mat mat[4,`i'] = results[1,1]
mat mat[5,`i'] = results[2,1]
mat mat[6,`i'] = results[4,1]
* Controlling for growth expectations
xtscc  f`i'l EPLregularworkers i.year l(0/4)gcrisis l(1/4)EPLregularworkers l(1/4)EPLtemp l(1/4).f1l ${f`i'} exp, fe lag(2)
matrix results = r(table)
mat mat[7,`i'] = results[1,1]
mat mat[8,`i'] = results[2,1]
mat mat[9,`i'] = results[4,1]
* Controlling for UB reforms
xtscc  f`i'l EPLregularworkers i.year l(0/4)gcrisis l(1/4)EPLregularworkers l(1/4)EPLtemp l(1/4).f1l ${f`i'} Unemploymentbenefitsoverall, fe lag(2)
matrix results = r(table)
mat mat[10,`i'] = results[1,1]
mat mat[11,`i'] = results[2,1]
mat mat[12,`i'] = results[4,1]
* Controlling for change in labor force of minorities
xtscc  f`i'l EPLregularworkers i.year l(0/4)gcrisis l(1/4)EPLregularworkers l(1/4)EPLtemp l(1/4).f1l ${f`i'} lf1524 lfw, fe lag(2)
matrix results = r(table)
mat mat[13,`i'] = results[1,1]
mat mat[14,`i'] = results[2,1]
mat mat[15,`i'] = results[4,1]
* Controlling for self-employment
xtscc  f`i'l2 EPLregularworkers i.year l(0/4)gcrisis l(1/4)EPLregularworkers l(1/4)EPLtemp l(1/4).f1l2 ${f`i'}, fe lag(2)
matrix results = r(table)
mat mat[16,`i'] = results[1,1]
mat mat[17,`i'] = results[2,1]
mat mat[18,`i'] = results[4,1]
* Controlling for lagged unemployment
xtscc  f`i'l EPLregularworkers i.year l(0/4)gcrisis l(1/4)EPLregularworkers l(1/4)EPLtemp l(1/4).f1l ${f`i'} l(1/2)d.unr, fe lag(2)
matrix results = r(table)
mat mat[19,`i'] = results[1,1]
mat mat[20,`i'] = results[2,1]
mat mat[21,`i'] = results[4,1]
}

* Save output
putexcel B4=matrix(mat)
